<#import "/layout/mainLayout.html" as mainLayout />

<#macro mainheading>
    <!--<link href="/plugins/ALTE/bootstrap/css/form-showcase.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-responsive.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-overrides.css" type="text/css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/plugins/morris/morris.css" rel="stylesheet"/>-->
</#macro>
<#assign mainheading = mainheading in mainLayout />

<#macro maincontent>
    <section class="content">


        <div class="row">
            <div class="col-xs-12">
                <div class="box">

                    <div class="col-xs-12">
                        <div class="box-primary">

                            <div class="col-md-12">
                                <div class="nav-tabs-custom">
                                    <ul class="nav nav-tabs">
                                        <li class="active"><a href="#activity"
                                                              data-toggle="tab"
                                                              aria-expanded="true">基本信息修改</a></li>

                                        <li class=""
                                            onclick="ClickTagSource()"><a href="#div_filmsource"
                                                                          data-toggle="tab"
                                                                          aria-expanded="false"
                                                                          id="div_hrefsource">播放来源</a>
                                        </li>
                                        <li class=""
                                            onclick="ClickTagStagephoto()"><a href="#div_stagephoto"
                                                                              data-toggle="tab"
                                                                              aria-expanded="false"
                                                                              id="div_hrefStagephoto">电影剧照</a>
                                        </li>
                                        <li class=""><a href="#div_filmscore"
                                                        data-toggle="tab"
                                                        aria-expanded="false">得分</a></li>
                                        <li class=""><a href="#div_filmct"
                                                        data-toggle="tab"
                                                        aria-expanded="false">统计</a></li>
                                        <li class=""
                                            onclick="ClickTagComment()"><a
                                                href="#div_filmconment"
                                                data-toggle="tab"
                                                aria-expanded="false">评论</a></li>

                                        <li class=""
                                            onclick="ClickTagSubject()"><a
                                                href="#div_subject"
                                                data-toggle="tab"
                                                aria-expanded="false">话题</a></li>

                                    </ul>
                                    <div class="tab-content">
                                        <div class="tab-pane active"
                                             id="activity">
                                            <!-- Post -->
                                            <form id="filmform"
                                                  class="form-horizontal"
                                                  method="post"
                                                  enctype="multipart/form-data">
                                                <div class=""
                                                     box-body
                                                     id="box-body">

                                                    <div class="form-group">
                                                        <label for="film_name"
                                                               class="col-sm-2 control-label">电影名称
                                                        </label>
                                                        <div class="col-sm-4">
                                                            <input type="text"
                                                                   class="form-control"
                                                                   name="film_name"
                                                                   id="film_name"
                                                                   value="${film.fName}"
                                                                   placeholder="电影名称" maxlength="20">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="film_keyword"
                                                               class="col-sm-2 control-label">电影看点
                                                        </label>
                                                        <div class="col-xs-5">
                                                            <input type="text"
                                                                   class="form-control"
                                                                   name="film_keyword"
                                                                   placeholder="电影看点"
                                                                   value="${film.fKeyword}"
                                                                   id="film_keyword" maxlength="50">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="film_price"
                                                               class="col-sm-2 control-label">电影价格
                                                        </label>
                                                        <div class="col-xs-3">
                                                            <select class="form-control"
                                                                    id="film_price"
                                                                    name="film_price">

                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">

                                                        <label for="film_year"
                                                               class="col-sm-2 control-label">年份
                                                        </label>
                                                        <div class="col-xs-3">
                                                            <select class="form-control"
                                                                    id="film_year"
                                                                    name="film_year">
                                                                <option value="-1">--年份--</option>
                                                                <option value="2017">2017</option>
                                                                <option value="2016">2016</option>
                                                                <option value="2015">2015</option>
                                                                <option value="2014">2014</option>
                                                                <option value="2013">2013</option>
                                                                <option value="2012">2012</option>
                                                                <option value="2011">2011</option>
                                                                <option value="2010">更早</option>
                                                            </select>
                                                        </div>
                                                        <label for="film_country"
                                                               class="col-sm-2 control-label">国家
                                                        </label>
                                                        <div class="col-xs-4">
                                                            <select class="form-control"
                                                                    id="film_country"
                                                                    name="film_country">

                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="film_director"
                                                               class="col-sm-2 control-label">导演
                                                        </label>
                                                        <div class="col-xs-3">
                                                            <input type="text"
                                                                   class="form-control"
                                                                   name="film_director"
                                                                   placeholder="导演"
                                                                   value="${film.fDirector}"
                                                                   id="film_director" maxlength="20">
                                                        </div>
                                                        <label for="film_performer"
                                                               class="col-sm-2 control-label">主演
                                                        </label>
                                                        <div class="col-xs-3">
                                                            <input type="text"
                                                                   class="form-control"
                                                                   name="film_performer"
                                                                   placeholder="主演"
                                                                   value='${film.fPerformer}'
                                                                   id="film_performer" maxlength="100">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="film_showdate"
                                                               class="col-sm-2 control-label">上映时间
                                                        </label>
                                                        <div class="col-xs-3">
                                                            <input type="text"
                                                                   class="form-control"
                                                                   name="film_showdate"
                                                                   placeholder="上映时间"
                                                                   value='${(film.fShowtime?string("yyyy-MM-dd"))!}'
                                                                   id="film_showdate">
                                                        </div>
                                                    </div>
                                                    <div class="form-group"
                                                         id="div_filmtype">

                                                    </div>

                                                    <div class="form-group">
                                                        <input type="hidden"
                                                               id="film_filmtype"
                                                               name="film_filmtype">
                                                        <label for="film_desc"
                                                               class="col-sm-2 control-label">
                                                            简介</label>
                                                        <div class="col-sm-4">
                                            <textarea class="form-control"
                                                      name="film_desc"
                                                      rows="3"
                                                      placeholder="简介 ..."
                                                      id="film_desc" maxlength="1000"></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-sm-2">
                                                        </div>
                                                        <div class="col-sm-2">
                                                            <img id="ImgPr"
                                                                 class="ImgPr"
                                                                 width="120"
                                                                 height="120" src='${(film.fPhoto)!}'/>
                                                        </div>
                                                        <label class="col-sm-2 control-label"
                                                               for="film_pic">选择图片
                                                        </label>
                                                        <div class="col-sm-2">
                                                            <input type="file"
                                                                   id="film_pic"
                                                                   name="film_pic">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-sm-2">
                                                        </div>
                                                        <div class="col-sm-2">
                                                            <img id="ImgPr2"
                                                                 class="ImgPr"
                                                                 width="120"
                                                                 height="120" src='${(film.fPhotos)!}'/>
                                                        </div>
                                                        <label class="col-sm-2 control-label"
                                                               for="film_pic">选择小图片
                                                        </label>
                                                        <div class="col-sm-2">
                                                            <input type="file"
                                                                   id="film_pic2"
                                                                   name="film_pic2">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-sm-2">
                                                        </div>
                                                        <div class="col-sm-2">
                                                            <img id="ImgPr1"
                                                                 class="ImgPr1"
                                                                 width="120"
                                                                 height="120"
                                                                 src='${(film.fPhotow)!}'/>
                                                        </div>
                                                        <label class="col-sm-2 control-label"
                                                               for="film_pic">选择宽度图片
                                                        </label>
                                                        <div class="col-sm-2">
                                                            <input type="file"
                                                                   id="film_pic1"
                                                                   name="film_pic1">
                                                        </div>
                                                    </div>


                                                    <!--<div class="form-group">-->
                                                        <!--<label class="col-sm-2 control-label">选择剧照-->
                                                        <!--</label>-->
                                                        <!--<div class="col-sm-4 pull-right">-->
                                                            <!--<input type="file"-->
                                                                   <!--name="film_stage">-->
                                                        <!--</div>-->
                                                        <!--<div class="col-sm-4 pull-right">-->
                                                            <!--<input type="file"-->
                                                                   <!--name="film_stage">-->
                                                        <!--</div>-->
                                                    <!--</div>-->
                                                </div><!-- /.box-body -->
                                                <div class="box-footer">
                                                    <button type="button"
                                                            class="btn btn-info pull-right"
                                                            onclick="UpdateFilm()">修改电影
                                                    </button>
                                                </div><!-- /.box-footer -->
                                            </form>
                                        </div><!-- /.tab-pane -->

                                        <div class="tab-pane"
                                             id="div_filmsource">
                                            <div class="box-header">


                                                <div class="row">
                                                    <div class="col-sm-9">
                                                    </div>
                                                    <div class="col-sm-3">
                                                        <a class="btn btn-block btn-success" href="#" onclick="SourceAdd('${film.fId}','1')">
                                                            添加来源</a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="box-body table-responsive no-padding">
                                                <table class="table table-bordered table-striped dataTable">
                                                    <tbody>
                                                    <thead>
                                                    <tr>
                                                        <th>来源名称</th>
                                                        <th>来源的url</th>
                                                        <th>添加时间</th>
                                                        <th>状态</th>
                                                        <th style="text-align: center">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="sourcecontent">


                                                    </tbody>
                                                </table>
                                            </div><!-- /.box-body -->

                                        </div><!-- /.tab-pane -->


                                        <div class="tab-pane"
                                             id="div_stagephoto">


                                            <div class="box-body table-responsive no-padding">
                                                <table class="table table-bordered table-striped dataTable">
                                                    <tbody>
                                                    <thead>
                                                    <tr>
                                                        <th>剧照地址</th>
                                                        <th>预览</th>
                                                        <th style="text-align: center">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="stagephotocontent">


                                                    </tbody>
                                                    <div id="stagephotopagecontent" class="pagination">
                                                        <div class="col-sm-2">
                                                            <img id="ImgPrStagephoto"
                                                                 class="ImgPr"
                                                                 width="120"
                                                                 height="120"/>
                                                        </div>
                                                        <form id="filmStagephotoform" class="form-horizontal" method="post" enctype="multipart/form-data">
                                                            <label class="col-sm-2 control-label" for="film_stagephoto">选择图片 </label>
                                                            <div class="col-sm-4"> <input type="file"id="film_stagephoto"name="film_stagephoto"> </div>
                                                            <button type="button" class="btn btn-info pull-right"onclick="AddFilmStagephoto()">添加剧照</button>
                                                        </form>
                                                    </div>
                                                </table>
                                            </div><!-- /.box-body -->

                                        </div><!-- /.tab-pane -->

                                        <div class="tab-pane"
                                             id="div_filmscore">

                                            <form id="filmscoreform"
                                                  class="form-horizontal"
                                                  method="post"
                                                  enctype="multipart/form-data">
                                                <input type="hidden"
                                                       value="${videoscore.fId}"
                                                       name="filmscore_id">
                                                <div class="form-group col-xs-12">
                                                    <label for="film_showdate"
                                                           class="col-sm-2 control-label">总得分
                                                    </label>
                                                    <div class="col-xs-3">
                                                        <label id="filmscore_fScore">${film.fScore!0}</label>
                                                    </div>
                                                    <div class="col-xs-7">
                                                    </div>
                                                </div>
                                                <div class="form-group col-xs-12">
                                                    <label for="film_showdate"
                                                           class="col-sm-2 control-label">豆瓣得分
                                                    </label>
                                                    <div class="col-xs-2">
                                                        <input type="text"
                                                               class="form-control"
                                                               name="filmscore_douban"
                                                               placeholder="豆瓣得分"
                                                               value='${videoscore.fDouban?string("#.##")}'
                                                               id="filmscore_douban">
                                                    </div>
                                                    <label for="film_showdate"
                                                           class="col-xs-2 control-label">烂番茄得分
                                                    </label>
                                                    <div class="col-xs-2">
                                                        <input type="text"
                                                               class="form-control"
                                                               name="filmscore_lanfanqie"
                                                               placeholder="烂番茄得分"
                                                               value='${videoscore.fLanfanqie?string("0.##")!0.0}'
                                                               id="filmscore_lanfanqie">
                                                    </div>

                                                    <label for="film_showdate"
                                                           class="col-xs-2 control-label">imdb得分
                                                    </label>
                                                    <div class="col-xs-2">
                                                        <input type="text"
                                                               class="form-control"
                                                               name="filmscore_imdb"
                                                               placeholder="imdb得分"
                                                               value='${videoscore.fImdb?string("0.##")!0.0}'
                                                               id="filmscore_imdb">
                                                    </div>
                                                </div>
                                                <div class=""
                                                     box-body>
                                                    <div class="box-footer">
                                                        <button type="button"
                                                                class="btn btn-info pull-right"
                                                                onclick="UpdateFilmScore()">修改评分
                                                        </button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div><!-- /.tab-pane -->
                                        <div class="tab-pane"
                                             id="div_filmct">
                                            <form id="filmcountform">
                                                <div class=""
                                                     box-body>
                                                    <div class="box-body">
                                                        <table class="table table-bordered">
                                                            <tbody>
                                                            <tr>
                                                                <th style="width: 10px">#</th>
                                                                <th style="width: 20px">真实数量</th>
                                                                <th style="width: 30px">人工调配</th>
                                                                <th style="width: 30px">总数</th>
                                                            </tr>
                                                            <tr>
                                                                <td>点击量</td>
                                                                <td>${film.fLookct}</td>
                                                                <td>
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           name="film_makelookct"
                                                                           placeholder="imdb得分"
                                                                           value="${film.fMakelookct}">
                                                                </td>
                                                                <td>
                                                                    ${film.fLookct+film.fMakelookct}
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>点赞量</td>
                                                                <td>${film.fGoodct}</td>
                                                                <td>
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           name="film_makegoodct"
                                                                           value="${film.fMakegoodct}">
                                                                </td>
                                                                <td>
                                                                    ${film.fGoodct+film.fMakegoodct}
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>收藏量</td>
                                                                <td>${film.fCollect}</td>
                                                                <td>
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           name="film_makecollectct"
                                                                           value="${film.fMakecollect}">
                                                                </td>
                                                                <td>
                                                                    ${film.fCollect+film.fMakecollect}
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>分享量</td>
                                                                <td>${film.fSharect}</td>
                                                                <td>
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           name="film_makesharect"
                                                                           value="${film.fMakecollect}">
                                                                </td>
                                                                <td>
                                                                    ${film.fSharect+film.fMakecollect}
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>播放量</td>
                                                                <td>${film.fPlayct}</td>
                                                                <td><input type="text"
                                                                           class="form-control"
                                                                           name="film_makeplayct"
                                                                           value="${film.fMakepalyct}">
                                                                </td>
                                                                <td>
                                                                    ${film.fPlayct+film.fMakepalyct}
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>购买量</td>
                                                                <td>${film.fBuyct}</td>
                                                                <td>—</td>
                                                                <td>${film.fBuyct}</td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                    <div class="box-footer">

                                                        <button type="button"
                                                                class="btn btn-info pull-right"
                                                                onclick="UpdateFilmCount()">修改统计
                                                        </button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div><!-- /.tab-pane -->
                                        <div class="tab-pane"
                                             id="div_filmconment">
                                            <div class="box-header">
                                                <div class="row">
                                                    <div class="col-sm-2">
                                                        <select class="form-control"
                                                                id="input_state">
                                                            <option value="-1">--状态--</option>
                                                            <option value="0">正常</option>
                                                            <option value="1">删除</option>

                                                        </select>
                                                    </div>
                                                    <div class="col-sm-2">
                                                        <select class="form-control"
                                                                id="input_report">
                                                            <option value="-1">--举报--</option>
                                                            <option value="0">未举报</option>
                                                            <option value="1">举报的</option>
                                                        </select>
                                                    </div>
                                                    <div class="col-sm-2">
                                                        <select class="form-control"
                                                                id="input_parent">
                                                            <option value="-1">--父子级显示--</option>
                                                            <option value="0">只显示父级</option>
                                                            <option value="1">只显示子级</option>
                                                        </select>
                                                    </div>


                                                    <div class="col-sm-1 pull-right">
                                                        <button
                                                                class="btn btn-block btn-default "
                                                                id="btn_search"
                                                                onclick="searchCommentList()">查询
                                                        </button>
                                                    </div>
                                                </div><!-- /.box-header -->
                                            </div>
                                            <div class="box-body table-responsive no-padding">
                                                <table class="table table-bordered table-striped dataTable">
                                                    <tbody>
                                                    <thead>
                                                    <tr>
                                                        <th>昵称</th>
                                                        <th>评论内容</th>
                                                        <th>举报次数</th>
                                                        <th>状态</th>
                                                        <th>是否子回复</th>
                                                        <th>评论时间</th>
                                                        <th style="text-align: center">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="bodycontent">


                                                    </tbody>
                                                </table>
                                            </div><!-- /.box-body -->
                                            <div id="pagecontent"
                                                 class="pagination"></div>
                                        </div><!-- /.tab-pane -->


                                        <div class="tab-pane"
                                             id="div_subject">
                                            <form id="subjectform"
                                                  class="form-horizontal"
                                                  method="post"
                                                  enctype="multipart/form-data">
                                            <div class="box-header">


                                                <div class="row">
                                                    <div class="col-sm-9">
                                                    </div>
                                                    <div class="col-sm-3">
                                                        <a class="btn btn-block btn-success" href="#" onclick="SubjectVideoContact('${film.fId}')">
                                                            关联话题</a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="box-body table-responsive no-padding">
                                                <table class="table table-bordered table-striped dataTable">
                                                    <tbody>
                                                    <thead>
                                                    <tr>
                                                        <th>主题名称</th>
                                                        <th>排序</th>
                                                        <th>添加时间</th>
                                                        <th>状态</th>
                                                        <th style="text-align: center">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="subjectcontent">


                                                    </tbody>
                                                </table>
                                            </div><!-- /.box-body -->
                                            </form>
                                        </div><!-- /.tab-pane -->

                                    </div><!-- /.tab-content -->
                                </div><!-- /.nav-tabs-custom -->
                            </div>
                        </div>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div><!-- /.row -->


    </section>

</#macro>
<#assign maincontent = maincontent in mainLayout />

<#macro mainfooter>
    <script src="/js/mortise/contrydata.js"></script>
    <script src="/js/jquery/jquery.form.js"></script>
    <script src="/js/mortise/source.js"></script>
    <script src="/js/mortise/subject.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#film_pic").uploadPreview({Img: "ImgPr", Width: 120, Height: 120});
            $("#film_pic1").uploadPreview({Img: "ImgPr1", Width: 120, Height: 120});
            $("#film_pic2").uploadPreview({Img: "ImgPr2", Width: 120, Height: 120});
        });
        var desc='${filminfo.fIntroduce?js_string}';
        $('#film_desc').val(desc)
        var _isaddScource = $.getUrlParam("isaddsource");

        if (_isaddScource) {
            $('#div_hrefsource').click();
            ClickTagSource();
        }
        //加载数据
        function loadData() {
            fillCountrySelect('film_country');
            fillDivVideoType('div_filmtype', '${film.fFilmtype}');

            FillPricetagSelect('film_price', '${film.fPricetagid}');
            $('#film_country').val('${film.fCountry}')
            $('#film_year').val('${film.fYear?c}')

        }
        loadData();
        function UpdateFilm() {
            var filmtypeidlist = '';
            $.each($('input[id^=input_check]'), function (index, item) {
                if (item.checked == true) {
                    filmtypeidlist += '1';
                }
                else {
                    filmtypeidlist += '0';
                }
            });
            $('#film_filmtype').val(filmtypeidlist);
            if (!$('#film_name').val()) {
                dialog({
                    title: '提示',
                    content: '请输入电影名称！',
                    cancel: false,
                    ok: function () {
                    }
                }).width(320).showModal();
                return;
            }

            var options = {
                url: '/api/video/updatefilm',
                type: 'post',
                data: {film_id: '${film.fId}'},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmform").ajaxSubmit(options);
        }

        function UpdateFilmScore() {
            if($('#filmscore_douban').val()==""){
                $('#filmscore_douban').val(0);
            }
            if($('#filmscore_lanfanqie').val()==""){
                $('#filmscore_lanfanqie').val(0);
            }
            if($('#filmscore_imdb').val()==""){
                $('#filmscore_imdb').val(0);
            }
            var options = {
                url: '/api/video/updatefilmscore',
                type: 'post',
                data: {filmid: '${film.fId}'},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                    $('#filmscore_fScore').html(data.result );
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmscoreform").ajaxSubmit(options);
        }

        //updatefilmcount


        function UpdateFilmCount() {
            var options = {
                url: '/api/video/updatefilmcount',
                type: 'post',
                data: {film_id: '${film.fId}'},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmcountform").ajaxSubmit(options);
        }

        /*
         * er classtype,
         @RequestParam String objectid,
         @RequestParam String commentid,
         @RequestParam String tocommentid,
         @RequestParam Integer parentid,
         @RequestParam Integer reportct,
         @RequestParam Integer show,
         @RequestParam int pno,
         @RequestParam int pagesize,
         @RequestParam int allcount*/
        function ClickTagComment() {
            searchCommentList();
        }
        var comment_data = {};
        function searchCommentList() {
            comment_data = {
                classtype: 1,
                objectid: '${film.fId}',
                commentid: '',
                tocommentid: '',
                parentid: $('#input_parent').val(),
                reportct: $('#input_report').val(),
                show: $('#input_state').val(),
                pno: 1,
                pagesize: 10,
                allcount: -1
            };
            LoadfilmCommentList();
        }
        //searchCommentList();
        function LoadfilmCommentList() {
            $('#pagecontent').html('');
            $.ajax({
                    url: '/api/comment/commentlist',
                    data: comment_data,
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                comment_data.allcount = data.result.count;
                                var html = '';
                                $.each(data.result.list, function (index, item) {
                                    html += getHtml(item);
                                })
                                $('#bodycontent').html(html);
                                ShowPage('pagecontent', comment_data, function (pno) {
                                    comment_data.pno = pno;
                                    LoadfilmCommentList();
                                });
                            }
                            else {
                                alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }
        function getHtml(dataObject) {
            var stateHtml = '';
            if (dataObject.fShow == 0) {

                stateHtml = '<span class="label label-success">正常</span>'
            }
            else if (dataObject.fShow == '1') {
                stateHtml = '<span class="label label-danger">删除</span>'
            }

            return ' <tr>' +
                '<td>' + dataObject.fCommentnick + '</td>' +
                '<td>' + dataObject.fContent + '</td>' +
                '<td>' + dataObject.fReportct + '</td>' +
                '<td>' + stateHtml + '</td>' +
                '<td>' + dataObject.fParentid + '</td>' +
                '<td>' + dataObject.fIntime + '</td>' +
                '<td>' +
                '<a style="cursor: pointer" href="#" onclick="UpdateCommentState(\'' + dataObject.fId + '\',1,' + dataObject.fParentid + ')">删除</a>&nbsp;&nbsp;' +
                '<a style="cursor: pointer" href="#" onclick="UpdateCommentState(\'' + dataObject.fId + '\',0,' + dataObject.fParentid + ')">显示</a></td>' +
                '</tr>';
        }
        function UpdateCommentState(fid, state, parentid) {
            $.ajax({
                    url: '/api/comment/updatecommentstate',
                    data: {fid: fid, state: state, parentid: parentid},
                    type: 'POST',
                    contentType: "application/x-www-form-urlencoded",
                    dataType: 'json',
                    success: function (data) {
                        if (data) {
                            if (data.code == 'OperateOk') {
                                dialog({
                                    title: '提示',
                                    content: '操作成功！',
                                    cancel: false,
                                    ok: function () {
                                    }
                                }).width(320).showModal();
                                LoadfilmCommentList();
                            }
                            else {
                                dialog({
                                    title: '提示',
                                    content: '操作失败！',
                                    cancel: false,
                                    ok: function () {
                                    }
                                }).width(320).showModal();
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }


        function ClickTagSource() {
            searchSourceList();
        }
        var source_data = {};
        function searchSourceList() {
            source_data = {
                classtype: 1,
                objectid: '${film.fId}'
            };
            LoadfilmSourceList();
        }
        //searchCommentList();
        function LoadfilmSourceList() {
            $.ajax({
                    url: '/api/video/getsourcelist',
                    data: source_data,
                    type: 'POST',
                    contentType: "application/x-www-form-urlencoded",
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                var html = '';
                                $.each(data.result, function (index, item) {
                                    html += getSourceHtml(item);
                                })
                                $('#sourcecontent').html(html);

                            }
                            else {
                                alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }

        function getSourceHtml(dataObject) {
            var stateHtml = '';
            if (dataObject.fShow == 0) {
                stateHtml = '显示'
            }
            else if (dataObject.fShow == '1') {
                stateHtml = '隐藏'
            }
            return ' <tr>' +
                '<td>' + dataObject.fSourcename + '</td>' +
//                '<td>' + decodeURI(dataObject.fSourceurl) + '</td>' +
                '<td>' + dataObject.fSourceurl + '</td>' +
                '<td>' + dataObject.fSourcetime + '</td>' +
                '<td>' + stateHtml + '</td>' +
                '<td>' +
                '<a style="cursor: pointer" href="#" onclick="SourceInfo(\''+dataObject.fId+'\',\''+dataObject.fSourcename+'\',\''+dataObject.fSourceurl+'\',\''+dataObject.fShow+'\')">修改</a></td>' +
                '</tr>';
        }

        function ClickTagStagephoto() {
            searchStagephotoList();
        }

        var stagephoto_data = {};
        function searchStagephotoList() {
            stagephoto_data = {
                fId: '${film.fId}'
            };
            LoadfilmStagephotoList();
        }



        function LoadfilmStagephotoList() {
            $.ajax({
                    url: '/api/video/getTagephotolist',
                    data: stagephoto_data,
                    contentType: "application/x-www-form-urlencoded",
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                var html = '';
                                $.each(data.result, function (index, item) {
                                    html += getStagephotoHtml(item);
                                })
                                $('#stagephotocontent').html(html);

                            }
                            else {
                                //alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }

        function getStagephotoHtml(dataObject) {

            return ' <tr>' +
                '<td>' + dataObject + '</td>' +
                '<td><img id="ImgPr" class="ImgPr" width="320" height="120" src=\''+dataObject+'\'/></td>' +
                '<td>' +
                '<a style="cursor: pointer" href="#" onclick="DelFilmStagephoto(\''+dataObject+'\')">删除</a></td>' +
                '</tr>';
        }


        function AddFilmStagephoto() {

            var options = {
                url: '/api/video/addfilmStagephoto',
                type: 'post',
                data: {film_id: '${film.fId}'},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                    searchStagephotoList();
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmStagephotoform").ajaxSubmit(options);

        }

        function DelFilmStagephoto(stagephoto) {

            var options = {
                url: '/api/video/delfilmStagephoto',
                type: 'post',
                data: {film_id: '${film.fId}',stagephoto:stagephoto},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                    searchStagephotoList();
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmStagephotoform").ajaxSubmit(options);
            searchStagephotoList();
        }



        function ClickTagSubject() {
            searchSubjectList();
        }
        var subject_data = {};
        function searchSubjectList() {
            subject_data = {
                videoid: '${film.fId}'
            };
            LoadfilmSubjectList();
        }
        //searchCommentList();
        function LoadfilmSubjectList() {
            $.ajax({
                    url: '/api/subject/videosubjectlist',
                    data: subject_data,
                    type: 'GET',
                    contentType: "application/x-www-form-urlencoded",
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                var html = '';
                                $.each(data.result, function (index, item) {
                                    html += getSubjectHtml(item);
                                })
                                $('#subjectcontent').html(html);

                            }
                            else {
                                alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }

        function getSubjectHtml(dataObject) {

            return ' <tr>' +
                '<td>' + dataObject.fTitle + '</td>' +
                '<td>' + dataObject.fDesc + '</td>' +
                '<td>' + dataObject.fIntime + '</td>' +
                '<td>' + dataObject.fType + '</td>' +
                '<td><a style="cursor: pointer" href="#" onclick="SubjectDel(\''+dataObject.fId+'\')">删除</a></td>' +
                '</tr>';
        }

        function SubjectDel(subject_id) {

            var options = {
                url: '/api/subject/delsubjectvideo',
                type: 'post',
                data: {videoid: '${film.fId}',subject_id:subject_id},
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                    searchSubjectList();
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#subjectform").ajaxSubmit(options);
            searchSubjectList();
        }






    </script>
</#macro>
<#assign mainfooter = mainfooter in mainLayout />
<@mainLayout.page title="电影管理"/>

